<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <!--
    CPAINT (Cross-Platform Asynchronous INterface Toolkit) - Version 2

    http://sf.net/projects/cpaint
    
    released under the terms of the GPL
    see http://www.fsf.org/licensing/licenses/gpl.txt for details

    authors:  Paul Sullivan <wiley14@gmail.com>, Dominique Stender <dstender@st-webdevelopment.de>
    Copyright (c) 2005-2006 Paul Sullivan, Dominique Stender - http://sf.net/projects/cpaint
  //-->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>a simple calculator example</title>

<!-- $Id$ -->
<!-- $Log$
<!-- Revision 1.3  2005/07/11 00:08:56  wiley14
<!-- Turned on debugging
<!--
<!-- Revision 1.2  2005/07/10 22:23:34  wiley14
<!-- Updated for simple test harness
<!-- -->

<script type="text/javascript" src="../../cpaint2.inc.js"></script>
<script type="text/javascript">
	var cp = new cpaint();
	cp.set_transfer_mode('get');
  cp.set_response_type('xml');
  cp.set_debug(true);
  
	function addNumbers() {
		var fileToUse = 'calculator.php';
		cp.call(fileToUse, 'add', response, document.getElementById('num1').value, document.getElementById('num2').value);
	}	
	
	function response(result) {
		document.getElementById('result').value = result.getElementsByTagName('ajaxResponse').item(0).firstChild.data;
	}

</script>
</head>

<body>
<p>Simple Test Harness (Adds two numbers) </p>
<form name="form1" method="post" action="">
  <p>
    <input name="num1" type="text" id="num1" size="5" maxlength="5"> 
  + 
  <input name="num2" type="text" id="num2" size="5" maxlength="5"> 
  <input type="button" name="Equals" value="=" onClick="addNumbers();">
  <input name="result" type="text" id="result" size="5">
</p>

</form>

</body>
</html>
